<template>
	<view>
		<page-head headTitle="钱包" :returnButton="true" @clickLeftReturn="clickLeftReturn"></page-head>
		<view class="m-t9">
			<view>
				<view class="scan-mt bg-pic flex align-center justify-content">
					<view>
						<view class="width flex align-center justify-content">
							<text class="line-height"><text class="store-size font-weight">{{info.balance}}</text><text>元</text></text>
						</view>
						<view class="width flex align-center justify-content">
							<text @tap="goWithdraw">去提现<text class="iconfont icon-dibudaohanglan-"></text></text>
						</view>
					</view>
				</view>	
				<view class="p-l-r m-t6">
					<view class="flex justify-between align-center border-botton p-t-b1" v-for="(item,index) in info.logs">
						<view>
							<view>
								<text class="fs-3">{{item.status_text}}</text>
							</view>
							<text class="fs-24">{{item.date}}</text>
						</view>
						<text class="fs-3 color-orange">{{item.account}}</text>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
import pageHead from '@/components/common/page-head.vue'
	export default {
		components:{
			pageHead
		},
		data() {
			return {
				info:{},			
			}
		},
		onLoad() {
			this.getInfo();
		},
		methods: {
			clickLeftReturn(){
				const pages = getCurrentPages() ;
				if(pages.length >1) {
					uni.navigateBack({
						delta: 1
					});
				}else{
					//返回上一页失败后强制回到商家首页
					uni.redirectTo({
						url: '../index/index'
					})
				}	
			},
			getInfo(){
				this.$myRequest({
					method:'POST',
					url:'/api/merchant/account',
				
				}).then(res=>{
					console.log(res);
					if(res.data.code == 1){
						this.info = res.data.data;
					}
				})
			},
			goWithdraw(){
				uni.navigateTo({
					url: '../withdraw/withdraw'
				})
			}
		}
	}
</script>

<style>
page{background-color: #FFFFFF;}
.bg-pic{height: 340rpx; background-image: url(../../../static/images/store.png);background-repeat:no-repeat;background-size:100% 100%;-moz-background-size:100% 100%;}
.scan-money{width: 428rpx;}
.store-size{font-size: 70rpx;}
</style>
